package br.com.j7.jdesk.persistence.entity;

import java.io.Serializable;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Version;

@Entity
@NamedQueries({ @NamedQuery(name="serviceAnnotation", query="Select sa from ServicesAnnotations sa" )})
public class ServicesAnnotations implements Serializable{

	private static final long serialVersionUID = 1L;
	
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	private Integer idServiceAnnotation;
	@Lob
	private String dsServiceAnnotation;
	
	@ManyToOne
	@JoinColumn(name="idServiceLog")
	private ServicesLogs serviceLog;
	
	@ManyToOne
	@JoinColumn(name="idUser")
	private Users user;
	
	@Version
	private Integer nrVersion;

	public ServicesAnnotations() {
	}
	
	public Integer getIdServiceAnnotation() {
		return idServiceAnnotation;
	}

	public void setIdServiceAnnotation(Integer idServiceAnnotation) {
		this.idServiceAnnotation = idServiceAnnotation;
	}

	public String getDsServiceAnnotation() {
		return dsServiceAnnotation;
	}

	public void setDsServiceAnnotation(String dsServiceAnnotation) {
		this.dsServiceAnnotation = dsServiceAnnotation;
	}

	public ServicesLogs getServiceLog() {
		return serviceLog;
	}

	public void setServiceLog(ServicesLogs serviceLog) {
		this.serviceLog = serviceLog;
	}

	public Users getUser() {
		return user;
	}

	public void setUser(Users user) {
		this.user = user;
	}

	public Integer getNrVersion() {
		return nrVersion;
	}
	
	public void setNrVersion(Integer nrVersion) {
		this.nrVersion = nrVersion;
	}
	
	@Override
	public int hashCode() {
		return idServiceAnnotation;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		ServicesAnnotations other = (ServicesAnnotations) obj;
		if (idServiceAnnotation == null) {
			if (other.idServiceAnnotation != null)
				return false;
		} else if (!idServiceAnnotation.equals(other.idServiceAnnotation))
			return false;
		return true;
	}
	
	
	

}
